import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from "path"
import { createSvgIconsPlugin } from "vite-plugin-svg-icons"
const pathResolve = dir => resolve(__dirname, dir);
import path from "path"
// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    createSvgIconsPlugin({
      iconDirs: [path.resolve(process.cwd(), "src/assets/svg")],
      symbolId: "icon-[dir]-[name]"
    })
  ],
  resolve: {
    alias: {
      '@': pathResolve('./src'), // Ensure this points to your 'src' directory
    },
  },
  server: {
    port: 8080, // 端口号
    open: true, // 自动打开
    cors: true, // 允许跨域
  },
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "scss",
      patterns: []
    }
  },
})
